﻿<UserControl x:Class="OnlineGameClient.View.GameRoomsView"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
    xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
             xmlns:comm="clr-namespace:Microsoft.Practices.Composite.Presentation.Commands;assembly=Microsoft.Practices.Composite.Presentation"
    xmlns:vm="clr-namespace:OnlineGameClient.ViewModel"
             mc:Ignorable="d"
    d:DesignHeight="300" d:DesignWidth="400"
             xmlns:sdk="http://schemas.microsoft.com/winfx/2006/xaml/presentation/sdk" Loaded="UserControl_Loaded">
    <UserControl.Resources>
    </UserControl.Resources>
    <Grid x:Name="LayoutRoot">
        <Grid.RowDefinitions>
            <RowDefinition Height="40"/>
            <RowDefinition Height="*"/>
        </Grid.RowDefinitions>
        <Grid HorizontalAlignment="Left">
            <Border Style="{StaticResource tabborder}"/>
            <StackPanel Grid.Row="0" Orientation="Horizontal" HorizontalAlignment="Left">
                <!--<Button Content="Refresh Room List" Margin="5" Padding="5"
                 comm:Click.Command="{Binding GetGameRoomsCommand}"/>-->
                <Button Content="Create new Game" Style="{StaticResource tabbutton}"
                 comm:Click.Command="{Binding CreateGameRoomCommand}"/>
            </StackPanel>
        </Grid>
        <Grid Grid.Row="1" Background="Silver">
            <Border Style="{StaticResource grayborder}">
                <ListBox ItemsSource="{Binding GameRoomList}" Name="gameroomlb1" BorderThickness="0">
                    <ListBox.ItemTemplate>
                        <DataTemplate>
                            <Grid Height="100">
                                <Grid.ColumnDefinitions>
                                    <ColumnDefinition Width="100"/>
                                    <ColumnDefinition Width="*"/>
                                </Grid.ColumnDefinitions>
                                <Border Margin="10" Background="Azure" CornerRadius="10">
                                    <Image Loaded="Image_Loaded"/>
                                </Border>
                                <StackPanel Grid.Column="1">
                                    <TextBlock Text="{Binding GameConfig.GameIdentityName}"/>
                                    <TextBlock Text="{Binding GameState}"/>
                                    <TextBlock Text="{Binding Path=Players[0].PlayerID, FallbackValue=Null}"/>
                                    <TextBlock Text="{Binding Path=Players.Count}"/>
                                    <Button HorizontalAlignment="Right" Content="Join this game"
                                    comm:Click.Command="{Binding Path=DataContext.AttendGameRoomCommand, ElementName=gameroomlb1}"
                                    comm:Click.CommandParameter="{Binding}"/>
                                </StackPanel>
                            </Grid>
                        </DataTemplate>
                    </ListBox.ItemTemplate>
                </ListBox>
            </Border>
        </Grid>
    </Grid>
</UserControl>
